import Vue from 'vue';

import 'normalize.css/normalize.css'; // A modern alternative to CSS resets
console.log('callback  main');
global.ENVIR = 'callback';
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import i18n from '@/lib/lang/index';
import store from '@/extend/store';
import router from '@/extend/router/callback/index';
import '@/lib/oidc';

import '@/styles/index.scss'; // 公共样式
import '@/styles/spacing.scss'; // gl的公共样式
import '@/assets/iconfont/iconfont.css';

import App from './App';
import * as filters from '@/lib/filter'; // 全局过滤器

import '@/assets/icons/index'; // icon
import './media.scss';

// 设置elementUi语言
Vue.use(ElementUI, {
  i18n: (key, value) => i18n.t(key, value)
});

// 兼容性解决
if (!window.location.origin) {
  window.location.origin =
    window.location.protocol +
    '//' +
    window.location.hostname +
    (window.location.port ? ':' + window.location.port : '');
}

// 注册全局过滤器
Object.keys(filters).forEach(key => {
  Vue.filter(key, filters[key]);
});

Vue.config.productionTip = false;

new Vue({
  el: '#app',
  i18n,
  store,
  router,
  render: h => h(App)
});
